/**
 * Copyright (c) 2012, lincomb Technology CO,LDT. All rights reserved.
 * Module: App推送
 * File: PushMessageDao.java
 * Purpose: App推送消息Dao层
 * Date: 2016-6-6
 */
package com.edais.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.edais.domain.AfficheTab;
import com.edais.domain.PushMessageRecord;
import com.edais.domain.UnReadMsgInfo;
import com.edais.persistence.PushMessageMapper;

/**
 * ClassName: PushMessageDao 
 * @Description: App推送消息Dao类
 * @author ZuoJun
 * @date 2016-6-6 17:36:29
 */
@Repository

public class PushMessageDao {
	
	@Autowired
	private PushMessageMapper pushMessageMapper;
	
	/**
	 * @Description: 保存手机设备信息
	 * @param param
	 * @author ZuoJun
	 * @date 2016-6-6 16:10
	 */
	public void saveMobileInfo(Map<String, Object> param){
		pushMessageMapper.saveMobileInfo(param);
	}
	
	/**
	 * @Description: 更新手机设备信息
	 * @param param
	 * @author ZuoJun
	 * @date 2016-6-6 16:10
	 */
	public void updateMobileInfo(Map<String, Object> param){
		pushMessageMapper.updateMobileInfo(param);
	}

	public void unbindOtherMobile(Map<String,Object> param){

	}
	/**
	 * @Description: 根据设备编号查询手机设备信息
	 * @param param
	 * @return List
	 * @author ZuoJun
	 * @date 2016-6-6 16:10
	 */
	public List<Map<String, Object>> queryDeviceInfoByDeviceNum(Map<String, Object> param){
		
		return pushMessageMapper.queryDeviceInfoByDeviceNum(param);
	}
	

	/**
	 * @Description: 根据用户ID、消息类别查询消息或公告信息
	 * @param params
	 * @return List<Map<String, Object>>
	 * @author gongyanlan
	 * @date 2017-2-16
	 */
	public List<PushMessageRecord> queryMessageByType(Map<String, Object> params){
		List<PushMessageRecord> messageList = pushMessageMapper.queryMessageByType(params);
		return messageList;
	}
	
	/**
	 * @Description: 根据用户ID、消息类别查询消息或公告信息条数
	 * @param params
	 * @return int
	 * @author gongyanlan
	 * @date 2017-2-16
	 */
	public int queryMessageCountByType(Map<String, Object> params){
		return pushMessageMapper.queryMessageCountByType(params);
	}
	

	
	/**
	 * @Description: 查询媒体报道信息
	 * @param params
	 * @return List
	 * @author gongyanlan
	 * @throws Exception 
	 * @date 2017-2-17
	 */
	public List<AfficheTab> queryMediaReportByType(Map<String, Object> params){
		List<AfficheTab> messageList = pushMessageMapper.queryMediaReportByType(params);
		return messageList;
	}
	
	/**
	 * @Description: 查询媒体报道信息条数
	 * @param params
	 * @return int
	 * @author ZuoJun
	 * @throws Exception 
	 * @date 2016-6-12 11:11:39
	 */
	public int queryMediaReportCountByType(Map<String, Object> params){
		return pushMessageMapper.queryMediaReportCountByType(params);
	}
	
	/**
	 * 查询媒体报道详细信息
	 * @param params
	 * @return
	 */
	public Map<String, Object> queryMediaReportDetail(Map<String, Object> params){
		Map<String, Object> map = pushMessageMapper.queryMediaReportDetail(params);
		Map<String, Object> buildMap =null;
		if(null!=map){
			buildMap= new HashMap<String, Object>();
			buildMap.put("title", map.get("title"));
			buildMap.put("details", map.get("html_url"));
			buildMap.put("imageUrl", map.get("small_icon_url"));
			buildMap.put("content", map.get("affiche_content"));
			buildMap.put("time", map.get("create_time"));
		}
		return buildMap;
	}
	
	/**
	 * @Description: 根据用户ID查询未读信息数
	 * @param params
	 * @return List
	 * @author WuHan
	 * @date 2017-2-16
	 */
	public  List<UnReadMsgInfo> queryUnReadNumList(Map<String, Object> params){
		return pushMessageMapper.queryUnReadNumList(params);
	}
	
	/**
	 * @Description: 清除用户未读信息数
	 * @param params
	 * @author WuHan
	 * @date 2016-6-7 21:18:00
	 */
	public void clearUnReadNum(Map<String, Object> params){
		
		pushMessageMapper.clearUnReadNum(params);
		
	}
	
}
